<?php

namespace Library\Widget;

class TabPane extends \Library\Widget {

	private $_tabs = array();
	private $_current = null;
	
	public function getTab( $key ) {
		if( !isset($this->_tabs[ $key ]) ) {
			$this->_tabs[ $key ] = new TabPane\Tab( $key, $this );
			if( $this->_current === null ) {
				$this->_current = $key;
			}
		}
		return $this->_tabs[ $key ];
	}
	
	public function setCurrent( $key ) {
		$this->_current = $key;
		return $this;
	}
	
	public function getCurrent() {
		return $this->_current;
	}
	
	public function isEmpty() {
		return count($this->_tabs) === 0;
	}
	
	public function getTabs() {
		return $this->_tabs;
	}
}
